package com.xh.bussiness.scheduletask;

import com.xh.bussiness.thirdapi.feihong.config.FhConfig;
import com.xh.bussiness.thirdapi.feihong.service.IFeihongService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;


/**
 * @author Pitt Cheung
 * @date 2021/6/15 18:57
 */
@Component
public class FeihongSchedultTask {

    @Autowired
    private FhConfig fhConfig;

    @Autowired
    private IFeihongService feihongService;

    // 每天凌晨一点半
    @Scheduled(cron = "0 30 1 * * ?")
    public void asyncTeachers(){
        if(!fhConfig.isAsyncTeachers()){
            return;
        }
        try {
            feihongService.importTeacher();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
